<?php

namespace App\Http\Forms;

use App\Modules\User\Models\User;
use Kris\LaravelFormBuilder\Form;

class StaffForm extends Form
{
    public function buildForm()
    {
        $this
            ->add('name', 'text', [
                'label' => "真实姓名",
                'rules' => "nullable|string",
            ])
            ->add('mobile', 'text', [
                'label' => "电话号",
                'rules' => "nullable|string",
            ])
            ->add('employee_identity', 'select', [
                'label' => "身份",
                'rules' => "required|string",
                'choices' => [
                    User::EMPLOYEE_IDENTITY_MIDDEL => User::EMPLOYEE_IDENTITY_MIDDEL,
                    User::EMPLOYEE_IDENTITY_PRIMARY => User::EMPLOYEE_IDENTITY_PRIMARY,
                    User::EMPLOYEE_IDENTITY_SENIOR => User::EMPLOYEE_IDENTITY_SENIOR,
                ],
            ])
            ->add('is_palm_management', 'select', [
                'label' => "开通权限",
                'rules' => "required|string",
                'choices' => [
                    0 => "否", 1 => "是"
                ],
            ])
            ->add('shop_id', 'select', [
                'attr' => ['class' => "form-control select2", 'multiple' => "multiple", "id" => 'shop_id'],
                'label' => "所属商铺",
                'rules' => "nullable|array",
                'choices' => $this->getData('shop'),
            ])
            ->add('position', 'text', [
                'label' => "职位",
                'rules' => "nullable|string",
            ])
            ->add('submit', 'submit', [
                'attr' => ['class' => "form-control btn btn-success"],
                'label' => '保存',
            ]);
    }
}
